import {observable, action} from 'mobx';
import AddStore from './AddStore';

export default class DocFormStore {
  @observable addStore = null;
  scope = null;
  history = null;
  
  @action
  init = (scope,history) => {
    this.scope = scope;
    this.history = history;
    this.addStore = new AddStore({parent: this, scope, path: `/add/${scope}`, saveBackFunc: this.saveBack});
  }
  
  saveBack = ({id = ''}) => {
    this.history.push(`/add/${this.scope}/doc/${id}`)
  }
}